package org.sourceprojects.pannonia;

import java.util.List;

public interface EventManager {
	void registerEventHandler(MarkedEventHandler eventHandler);
	void registerEventHandler(Object eventHandler);
	
	void removeEventHandler(MarkedEventHandler eventHandler);
	void removeEventHandler(Object eventHandler);
	
	<T> T fireEvent(Event event);
	<T> T fireEvent(Event event, Object... arguments);
	<T> T fireEvent(Object receiver, Event event);
	<T> T fireEvent(Object receiver, Event event, Object... arguments);
	
	<T> void registerTopic(Topic topic, Callback<T> callback);
	<T> void postTopicMessage(Topic topic, Message<T> message);
	<T> void removeTopicMessage(Topic topic, Message<T> message);
	<T> List<Message<T>> queryTopic(Topic topic);
	
	<T> void registerQueue(String name, Callback<T> callback);
	<T> void postQueueMessage(String name, Message<T> message);
	<T> Message<T> dequeueMessage(String name);
	
	Queue getQueue(String name);
	
	<T> void announceMessage(Message<T> message);
}
